home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / utility / utilfile / xfh.lha / XFH / Source / DoDOS.a < prev    next >
Text File  |  1996-11-26  |  2KB  |  87 lines

  1. *  DoDOS.asm - Call function from an AmigaDOS process context.
  2. *  Copyright (C) 1991, 1992, 1993 Kristian Nielsen.
  3. *
  4. *  This file is part of XFH, the compressing file system handler.
  5. *
  6. *  This program is free software; you can redistribute it and/or modify
  7. *  it under the terms of the GNU General Public License as published by
  8. *  the Free Software Foundation; either version 2 of the License, or
  9. *  (at your option) any later version.
  10. *
  11. *  This program is distributed in the hope that it will be useful,
  12. *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. *  GNU General Public License for more details.
  15. *
  16. *  You should have received a copy of the GNU General Public License
  17. *  along with this program; if not, write to the Free Software
  18. *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20.  
  21. *************************************************************************
  22. *
  23. * Project: CFS
  24. * File: DoDOS.a
  25. *
  26. * Kludge to make a call to DeviceProc. This process executes a function
  27. * for the handler, permitting AmigaDOS calls.
  28. *
  29. *************************************************************************
  30.  
  31.     INCLUDE    "exec/types.i"
  32.     INCLUDE    "dos/dosextens.i"
  33.     INCLUDE    "exec/ports.i"
  34.  
  35.     SECTION    DoDeviceProc,CODE
  36.  
  37.     XDEF    _DoDOS
  38.     XDEF    _DoDOSSeg
  39.     XDEF    @DoDOSSeg
  40.  
  41.     XREF    _LVOFindTask
  42.     XREF    _LVOWaitPort
  43.     XREF    _LVOGetMsg
  44.     XREF    _LVOForbid
  45.     XREF    _LVOReplyMsg
  46.  
  47.     XREF    _LinkerDB
  48.  
  49. _DoDOSSeg
  50. @DoDOSSeg
  51.     dc.l    0        ;Dummy seglist entry.
  52. _DoDOS
  53.     LEA    _LinkerDB,A4
  54.     move.l    4.W,a6
  55.     suba.l    a1,a1
  56.     jsr    _LVOFindTask(a6)
  57.     movea.l    d0,a2
  58.     lea    pr_MsgPort(a2),a2
  59. msgloop
  60.     movea.l    a2,a0
  61.     jsr    _LVOWaitPort(a6)
  62.     movea.l    a2,a0
  63.     jsr    _LVOGetMsg(a6)
  64.     tst.l    d0
  65.     beq.s    msgloop
  66.  
  67. * The first long word after the message structure is the address of
  68. * the function to call. The message is passed in a0.
  69.  
  70.     movea.l    d0,a2
  71.     movea.l    a2,a0
  72.     movea.l    MN_SIZE(a0),a1
  73.     jsr    (a1)
  74.  
  75. * Now reply the message, and exit.
  76.  
  77.     jsr    _LVOForbid(a6)    ;Musn't unload until we're done.
  78.     movea.l    a2,a1
  79.     jsr    _LVOReplyMsg(a6)
  80.  
  81. * Exit under the spell of the Forbid().
  82.  
  83.     rts
  84.  
  85.     END
  86.  
  87.